<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./jquery-1.12.4.min.js"></script>
    <title>Document</title>
</head>

<body>

    <div class="star">
        <img src="./images/start.png">
        <img src="./images/start.png">
        <img src="./images/start.png">
        <img src="./images/start.png">
        <img src="./images/start.png">
    </div>

    <script>
        $('img').each(function(i) {
            $(this).mouseover(() => {
                $(this).css("background-color", "yellow")

                $(this).prevAll().css("background-color", "yellow")

            })
            $(this).mouseleave(() => {
                $(this).css("background-color", "transparent")
                $(this).prevAll().css("background-color", "transparent")
            })

        })
    </script>
</body>

</html>